package com.mc.moring.bean;

import android.text.TextUtils;
import android.util.Log;

import com.mc.moring.util.GsonUtils;

import org.json.JSONObject;

public class AppKycPersonalInformacionConfig {


    private static AppKycPersonalInformacionConfig instance = new AppKycPersonalInformacionConfig();

    public static AppKycPersonalInformacionConfig getInstance() {
        return instance;
    }

    private WorkInfoConfigBean workInfoConfig;

    private UserInfoConfig userInfoConfig;

    private FamilyInfoConfigBean familyInfoConfig;

    public void initConfigData(JSONObject dataObject){
        userInfoConfig = new UserInfoConfig();
        instance.setUserInfoConfig(userInfoConfig);
        JSONObject userInfo = dataObject.optJSONObject("userInfoConfig");
        if (userInfo != null) {
            userInfoConfig.birthday = userInfo.optString("birthday");
            userInfoConfig.lastName = userInfo.optString("lastName");
            userInfoConfig.firstName = userInfo.optString("firstName");
            userInfoConfig.nationalId = userInfo.optString("nationalId");
            userInfoConfig.gender = userInfo.optString("gender");
            userInfoConfig.educationDegree = userInfo.optString("educationDegree");
            userInfoConfig.lastMotherName = userInfo.optString("lastMotherName");
            userInfoConfig.middleName = userInfo.optString("middleName");
            userInfoConfig.debt = userInfo.optString("debt");
            userInfoConfig.maritalStatus = userInfo.optString("maritalStatus");
            userInfoConfig.email = userInfo.optString("email");
        }
        workInfoConfig = new WorkInfoConfigBean();
        instance.setWorkInfoConfig(workInfoConfig);
        JSONObject workInfo = dataObject.optJSONObject("workInfoConfig");
        if (workInfo != null) {
            workInfoConfig.workStatus = workInfo.optString("workStatus");
            workInfoConfig.income = workInfo.optString("income");
            workInfoConfig.frequencyOfSalaryPaid = workInfo.optString("frequencyOfSalaryPaid");
            workInfoConfig.payDay2 = workInfo.optString("payDay2");
            workInfoConfig.companyName = workInfo.optString("companyName");
            workInfoConfig.payDay = workInfo.optString("payDay");
        }
        familyInfoConfig = new FamilyInfoConfigBean();
        instance.setFamilyInfoConfig(familyInfoConfig);
        JSONObject familyInfo = dataObject.optJSONObject("familyInfoConfig");
        if (familyInfo != null) {
            Log.e("----getfam", GsonUtils.INSTANCE.getGson().toJson(familyInfo));
            familyInfoConfig.contactSwitch = familyInfo.optString("contactSwitch");
            familyInfoConfig.constituency = familyInfo.optString("constituency");
            familyInfoConfig.postalCode = familyInfo.optString("postalCode");
            familyInfoConfig.county = familyInfo.optString("county");
            familyInfoConfig.wards = familyInfo.optString("wards");
            familyInfoConfig.currentAddress = familyInfo.optString("currentAddress");
            familyInfoConfig.maritalStatus = familyInfo.optString("maritalStatus");
        }


    }

    public WorkInfoConfigBean getWorkInfoConfig() {
        return workInfoConfig;
    }

    public void setWorkInfoConfig(WorkInfoConfigBean workInfoConfig) {
        this.workInfoConfig = workInfoConfig;
    }

    public UserInfoConfig getUserInfoConfig() {
        return userInfoConfig;
    }

    public void setUserInfoConfig(UserInfoConfig userInfoConfig) {
        this.userInfoConfig = userInfoConfig;
    }

    public FamilyInfoConfigBean getFamilyInfoConfig() {
        return familyInfoConfig;
    }

    public void setFamilyInfoConfig(FamilyInfoConfigBean familyInfoConfig) {
        this.familyInfoConfig = familyInfoConfig;
    }

    public static class WorkInfoConfigBean {
        private String workStatus;
        private String income;
        private String frequencyOfSalaryPaid;
        private String payDay2;
        private String companyName;
        private String payDay;

        public String getWorkStatus() {
            return workStatus;
        }

        public void setWorkStatus(String workStatus) {
            this.workStatus = workStatus;
        }

        public String getIncome() {
            return income;
        }

        public void setIncome(String income) {
            this.income = income;
        }

        public String getFrequencyOfSalaryPaid() {
            return frequencyOfSalaryPaid;
        }

        public void setFrequencyOfSalaryPaid(String frequencyOfSalaryPaid) {
            this.frequencyOfSalaryPaid = frequencyOfSalaryPaid;
        }

        public String getPayDay2() {
            return payDay2;
        }

        public void setPayDay2(String payDay2) {
            this.payDay2 = payDay2;
        }

        public String getCompanyName() {
            return companyName;
        }

        public void setCompanyName(String companyName) {
            this.companyName = companyName;
        }

        public String getPayDay() {
            return payDay;
        }

        public void setPayDay(String payDay) {
            this.payDay = payDay;
        }
    }

    public static class UserInfoConfig {
        private String birthday;
        private String lastName;
        private String firstName;
        private String nationalId;
        private String gender;
        private String educationDegree;
        private String lastMotherName;
        private String middleName;
        private String debt;
        private String maritalStatus;
        private String email;

        public String getBirthday() {
            return birthday;
        }

        public void setBirthday(String birthday) {
            this.birthday = birthday;
        }

        public String getLastName() {
            return lastName;
        }

        public void setLastName(String lastName) {
            this.lastName = lastName;
        }

        public String getFirstName() {
            return firstName;
        }

        public void setFirstName(String firstName) {
            this.firstName = firstName;
        }

        public String getNationalId() {
            return nationalId;
        }

        public void setNationalId(String nationalId) {
            this.nationalId = nationalId;
        }

        public String getGender() {
            return gender;
        }

        public void setGender(String gender) {
            this.gender = gender;
        }

        public String getEducationDegree() {
            return educationDegree;
        }

        public void setEducationDegree(String educationDegree) {
            this.educationDegree = educationDegree;
        }

        public String getLastMotherName() {
            return lastMotherName;
        }

        public void setLastMotherName(String lastMotherName) {
            this.lastMotherName = lastMotherName;
        }

        public String getMiddleName() {
            return middleName;
        }

        public void setMiddleName(String middleName) {
            this.middleName = middleName;
        }

        public String getDebt() {
            return debt;
        }

        public void setDebt(String debt) {
            this.debt = debt;
        }

        public String getMaritalStatus() {
            return maritalStatus;
        }

        public void setMaritalStatus(String maritalStatus) {
            this.maritalStatus = maritalStatus;
        }

        public String getEmail() {
            return email;
        }

        public void setEmail(String email) {
            this.email = email;
        }
    }

    public static class FamilyInfoConfigBean {
        private String contactSwitch;
        private String constituency;
        private String postalCode;
        private String county;
        private String wards;
        private String currentAddress;

        private String maritalStatus;

        public String getSwitch() {
            return contactSwitch;
        }

        public void setSwitch(String cSwitch) {
            this.contactSwitch = cSwitch;
        }

        public String getConstituency() {
            return constituency;
        }

        public void setConstituency(String constituency) {
            this.constituency = constituency;
        }

        public String getPostalCode() {
            return postalCode;
        }

        public void setPostalCode(String postalCode) {
            this.postalCode = postalCode;
        }

        public String getCounty() {
            return county;
        }

        public void setCounty(String county) {
            this.county = county;
        }

        public String getWards() {
            return wards;
        }

        public void setWards(String wards) {
            this.wards = wards;
        }

        public String getCurrentAddress() {
            return currentAddress;
        }

        public void setCurrentAddress(String currentAddress) {
            this.currentAddress = currentAddress;
        }

        public void setMaritalStatus(String maritalStatus) {
            this.maritalStatus = maritalStatus;
        }

        public String getMaritalStatus() {
            if (TextUtils.isEmpty(maritalStatus)){
                maritalStatus = "1";
            }
            return maritalStatus;
        }
    }
}
